<template>
  <div class="recommended-container">
    <div class="title-con">
      <div class="title">推荐专题</div>
    </div>
    <div class="theme-scroll" scroll-x="true">
      <div
        class="theme-item"
        v-for="item in recommendList"
        :key="item.id"
        @click="goTheme(item)"
      >
        <div class="text-title">{{ item.title }}</div>
        <div class="text-footer">{{ item.themeDescribe }}</div>
        <div class="colorBar"></div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "",
  props: [],
  data() {
    return {
      recommendList: [],
    };
  },
  created() {
    this.getRecommend();
  },
  methods: {
    //获取推荐专题数据列表
    async getRecommend() {
      const res = await this.$API(
        "/vv/solutionSubject/theme.do?_dataType=json&_dataClientType=3&_dataClientType=3&client_type=40&solutionSubjectId=1&pageNum=1&pageSize=6&templatePageSize=6&type=3&device=2"
      );
      if (res.status !== 200) return this.$toast.fail("请求失败");
      this.recommendList = res.data.body.data.themes;
    },
    //跳转theme页面
    goTheme(item) {
      this.$router.push({
        path: "/theme",
        query: {
          themeId: item.id,
          n: item.title,
          type: item.formatType,
          sort: item.videoSizeType,
        },
      });
    },
  },
};
</script>

<style lang="less" scoped>
::-webkit-scrollbar {
  display: none;
}
.recommended-container {
  padding: 0 12px;
  .title-con {
    padding: 30px 0 20px 0;
    .title {
      font-size: 16px;
      color: #000;
      font-weight: 600;
    }
  }
  .theme-scroll {
    font-size: 0;
    white-space: nowrap;
    overflow-x: auto;

    .theme-item {
      position: relative;
      width: 120px;
      height: 65px;
      padding-left: 16px;
      display: inline-block;
      font-weight: bolder;
      background: #fff;
      -webkit-box-shadow: 0 0.17067rem 0.768rem 0 rgb(20 38 86 / 10%);
      box-shadow: 0 0.17067rem 0.768rem 0 rgb(20 38 86 / 10%);
      -webkit-box-sizing: border-box;
      box-sizing: border-box;
      border-radius: 5px;
      overflow: hidden;
      margin: 12px 10px 16px 0;
      text-align: left;
      .text-title {
        color: #000;
        font-size: 14px;
        font-weight: 700;
        margin-top: 16px;
      }
      .text-footer {
        color: rgba(0, 0, 0, 0.6);
        font-size: 12px;
        margin-top: 4px;
      }
      .colorBar {
        position: absolute;
        width: 50px;
        height: 50px;
        border-radius: 50%;
        right: -25px;
        bottom: -25px;
        background: #ff406c;
      }
    }
  }
}
</style>

